/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aslan
 */
@Entity
@Table(name = "gottest")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Gottest.findAll", query = "SELECT g FROM Gottest g"),
    @NamedQuery(name = "Gottest.findByUserId", query = "SELECT g FROM Gottest g WHERE g.gottestPK.userId = :userId"),
    @NamedQuery(name = "Gottest.findByTestId", query = "SELECT g FROM Gottest g WHERE g.gottestPK.testId = :testId"),
    @NamedQuery(name = "Gottest.findByDate", query = "SELECT g FROM Gottest g WHERE g.date = :date"),
    @NamedQuery(name = "Gottest.findByGrade", query = "SELECT g FROM Gottest g WHERE g.grade = :grade")})
public class Gottest implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected GottestPK gottestPK;
    @Basic(optional = false)
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    @Basic(optional = false)
    @Column(name = "grade")
    private int grade;

    public Gottest() {
    }

    public Gottest(GottestPK gottestPK) {
        this.gottestPK = gottestPK;
    }

    public Gottest(GottestPK gottestPK, Date date, int grade) {
        this.gottestPK = gottestPK;
        this.date = date;
        this.grade = grade;
    }

    public Gottest(int userId, int testId) {
        this.gottestPK = new GottestPK(userId, testId);
    }

    public GottestPK getGottestPK() {
        return gottestPK;
    }

    public void setGottestPK(GottestPK gottestPK) {
        this.gottestPK = gottestPK;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public int getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (gottestPK != null ? gottestPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gottest)) {
            return false;
        }
        Gottest other = (Gottest) object;
        if ((this.gottestPK == null && other.gottestPK != null) || (this.gottestPK != null && !this.gottestPK.equals(other.gottestPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Gottest[ gottestPK=" + gottestPK + " ]";
    }
    
}
